<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.yaodian100.com/jsp/yaodian100" prefix="yaodian100" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath() %>'/>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script language="javascript">
	$().ready( function() {
		$('#startDateIdxParam').datepick({showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"}); 
		$('#endDateIdxParam').datepick({showOn: 'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd"});
	});
</script>
<style type="text/css">
	.bg-active {
		background: #D4FAED;
	}
</style>
<h1>首页 - 广告管理(行销)<br/>
	<div class="f-link">
		<s:if test='%{"PCL".equals(from)}'>
			<s:set name="actionUrl" value='%{"addPclAdv.do"}' />
		</s:if>
		<s:else>
			<s:set name="actionUrl" value='%{"addIdxAdv.do"}' />
		</s:else>
		<a href="${midContextPath}/generate/idxV5/${actionUrl}">新增首页广告</a>
	</div>
</h1>
<s:if test='%{"PCL".equals(from)}'>
	<s:set name="actionUrl" value='%{"idxV5/searchPcl.do"}' />
</s:if>
<s:else>
	<s:set name="actionUrl" value='%{"idxV5/searchIdx.do"}' />
</s:else>
<div class="data-form"><s:form action="%{actionUrl}" method="post">
	<b>广告名称：</b>
	<input name="advNameIdxParam" type="text" id="advNameIdxParam"
		value="${advNameIdxParam}" size="20" maxlength="20">
	<b>起迄时间：</b>
	<input name="startDateIdxParam" type="text" id="startDateIdxParam"
		value="${startDateIdxParam}" size="10" maxlength="10">
    ~ <input name="endDateIdxParam" type="text" id="endDateIdxParam"
		value="${endDateIdxParam}" size="10" maxlength="10">
	<BR>
	状态：<s:select name="advStatusIdxParam" value="%{advStatusIdxParam}" headerKey="" headerValue="全部"
		list="advStatusMenu.options" listKey="key" listValue="value.name" />
	类型：<s:select name="advTypeIdxParam" value="%{advTypeIdxParam}" 
		list="advIdxTypeMenu.options" listKey="key" listValue="value.name" />
	<input type="button" value="搜寻" onClick="this.form.submit();" />
</s:form></div>
<br />
<table class="tb-1"  width="100%">
	<thead>
		<tr>
			<th>#</th>
			<th>名称</th>
			<th>起迄时间</th>
			<th>状态</th>
			<th>类型</th>
			<th>剩几天到期</th>
			<c-rt:if test="${advTypeIdxParam eq 'IDX_MAINGOLD_V2'}">
				<th>排序</th>
			</c-rt:if>
			<th>最后更新日期</th>
			<th>管理</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${viewPmAdvertises}" var="advertise" varStatus="rows_index">
			<s:if test=""></s:if>
			<c-rt:choose>
				<c-rt:when test="${advertise.advStatus == '20'}">
					<c-rt:set var="trClass" value="bg-active"></c-rt:set>
				</c-rt:when>
				<c-rt:otherwise>
					<c-rt:set var="trClass" value="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}"></c-rt:set>
				</c-rt:otherwise>
			</c-rt:choose>
			<tr class="${trClass}">
				<td>${rows_index.count}</td>
				<td>${advertise.advName}</td>
				<td>
					<fmt:formatDate value="${advertise.startDate}" pattern="yyyy-MM-dd HH:mm"/> ~ 
					<fmt:formatDate value="${advertise.endDate}" pattern="yyyy-MM-dd HH:mm"/>
				</td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.advStatus == '90'}">
							<span class="txt-rd">
								${advStatusMenu.options[advertise.advStatus].name}
							</span>
						</c-rt:when>
						<c-rt:otherwise>
							${advStatusMenu.options[advertise.advStatus].name}
						</c-rt:otherwise>
					</c-rt:choose>
				</td>
				<td>${advIdxTypeMenu.options[advertise.advType].name}</td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.yetPromo < 0 and advertise.startPromo > 0}">未开始</c-rt:when>
						<c-rt:when test="${advertise.yetPromo > 0 and advertise.startPromo < 0}">已到期</c-rt:when>
						<c-rt:otherwise>${advertise.startPromo}</c-rt:otherwise>
					</c-rt:choose>
				</td>
				<c-rt:if test="${advTypeIdxParam eq 'IDX_MAINGOLD_V2'}">
					<td>${advertise.showSeq}</td>
				</c-rt:if>
				<td><fmt:formatDate value="${advertise.modifyDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>
					<c-rt:choose>
						<c-rt:when test="${advertise.advType eq 'TOP4_TAG' }">
							<a href="${midContextPath}/generate/top4Tag/editTop4Tag.do?advId=${advertise.id}">修改</a>
							<a href="${midContextPath}/generate/top4Tag/cloneTop4Tag.do?advId=${advertise.id}">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_TOP4_TAG' }">
							<a href="${midContextPath}/generate/top4Tag/editTop4Tag.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/top4Tag/cloneTop4Tag.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_MAINGOLD_V2' }">
							<a href="${midContextPath}/generate/mainGold/editIdxMainGoldAdv_V2.do?advId=${advertise.id}&from=V5">修改</a>
							<a href="${midContextPath}/generate/mainGold/cloneIdxMainGoldAdv_V2.do?advId=${advertise.id}&from=V5">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_MAINGOLD_V2' }">
							<a href="${midContextPath}/generate/mainGold/editIdxMainGoldAdv_V2.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/mainGold/cloneIdxMainGoldAdv_V2.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_TOPSPAN'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=V5">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=V5">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_TOPSPAN'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_HOTSALE_BANNER'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=V5">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=V5">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_HOTSALE_BANNER'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_WAISTLINE_V5'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=V5">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=V5">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_WAISTLINE_V5'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_BANK_BANNER'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=V5">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=V5">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_BANK_BANNER'}">
							<a href="${midContextPath}/generate/idxImageAdv/editIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxImageAdv/cloneIdxImageAdv.do?adv.id=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_HOTSALE_V5'}">
							<a href="${midContextPath}/generate/idxHotSaleV5/editIdxHotSale.do?advId=${advertise.id}">修改</a>
							<a href="${midContextPath}/generate/idxHotSaleV5/cloneIdxHotSale.do?advId=${advertise.id}">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_HOTSALE_V5'}">
							<a href="${midContextPath}/generate/idxHotSaleV5/editIdxHotSale.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxHotSaleV5/cloneIdxHotSale.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_SPECIAL_ACT'}">
							<a href="${midContextPath}/generate/idxSpecialAct/editIdxSpecialAct.do?advId=${advertise.id}">修改</a>
							<a href="${midContextPath}/generate/idxSpecialAct/cloneIdxSpecialAct.do?advId=${advertise.id}">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_SPECIAL_ACT'}">
							<a href="${midContextPath}/generate/idxSpecialAct/editIdxSpecialAct.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxSpecialAct/cloneIdxSpecialAct.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_SALE_V5'}">
							<a href="${midContextPath}/generate/idxSaleV5/editIdxSaleV5.do?advId=${advertise.id}">修改</a>
							<a href="${midContextPath}/generate/idxSaleV5/cloneIdxSaleV5.do?advId=${advertise.id}">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_SALE_V5'}">
							<a href="${midContextPath}/generate/idxSaleV5/editIdxSaleV5.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxSaleV5/cloneIdxSaleV5.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'IDX_BRAND_RECOMMEND'}">
							<a href="${midContextPath}/generate/idxBrandRecommend/editIdxBrandRecommend.do?advId=${advertise.id}">修改</a>
							<a href="${midContextPath}/generate/idxBrandRecommend/cloneIdxBrandRecommend.do?advId=${advertise.id}">复制</a>
						</c-rt:when>
						<c-rt:when test="${advertise.advType eq 'PCL_BRAND_RECOMMEND'}">
							<a href="${midContextPath}/generate/idxBrandRecommend/editIdxBrandRecommend.do?advId=${advertise.id}&from=PCL">修改</a>
							<a href="${midContextPath}/generate/idxBrandRecommend/cloneIdxBrandRecommend.do?advId=${advertise.id}&from=PCL">复制</a>
						</c-rt:when>
					</c-rt:choose>
				</td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<yaodian100:pageutil link="${midContextPath}/generate/idxV5/searchIdx.do" pagerObj="${pager}" />